﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="TestItem.aspx.cs" Inherits="TestItem" Title="产品检验能力管理" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
    <script type="text/javascript">
        function setPName()
        {
           if( $('#<%=ckbIsNewPName.ClientID%>').attr('checked')==true)
           {
                $('#<%=ddlCreatePName.ClientID%>').hide();
                $('#<%=txtCreatePName.ClientID%>').show();
           }
           else
           {
                $('#<%=ddlCreatePName.ClientID%>').show();
                $('#<%=txtCreatePName.ClientID%>').hide();
           }
        }
        
        function setPModel()
        {
            if( $('#<%=ckbIsNewPModel.ClientID%>').attr('checked')==true)
           {
                $('#<%=ddlCreatePModel.ClientID%>').hide();
                $('#<%=txtCreatePModel.ClientID%>').show();
           }
           else
           {
                $('#<%=ddlCreatePModel.ClientID%>').show();
                $('#<%=txtCreatePModel.ClientID%>').hide();
           }
        }
        
        //上传产品检验能力模板文件。
        function InvokePopUploadParFile(pcaid,type)
        {
            var url= 'uploadfile2.aspx?product&pccid='+'<%=this.btnRefresh.ClientID%>'+'&PCAID='+pcaid+'&templateType='+type ;
            window.open(url,'上传','height=340,width=600,resizable=yes');             
        } 
    </script>
    
    <h1 id="pagetitle" class="pagetitle">
        产品检验能力管理
        <asp:UpdateProgress ID="UpdateProgress1" runat="server">
            <ProgressTemplate>
                <div class="anistyle" id="ani">
                    正在加载数据，请耐心等待...
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
    </h1>
    <asp:UpdatePanel ID="UpdatePanel" runat="server">
        <ContentTemplate>
            <div runat="server" id="divResult" class="divResult">
                <asp:Label ID="OperationResult" CssClass="result" runat="server" Text=""></asp:Label>
            </div>
            <asp:Panel ID="mainPanel" runat="server" CssClass="InfoArea">
                <table width="100%" cellpadding="1" cellspacing="1" bgcolor="#e1e1e1">
                    <tr>
                        <td width="20%" bgcolor="white" valign="top">
                            <div style="overflow-x: auto; overflow-y: auto; height: 480px; width: 200px;">
                                <asp:TreeView ID="productTreeView" runat="server" Height="100%" ImageSet="WindowsHelp"
                                    OnSelectedNodeChanged="productTreeView_SelectedNodeChanged" Width="100%">
                                    <ParentNodeStyle Font-Bold="False" />
                                    <HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
                                    <SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False" HorizontalPadding="0px"
                                        VerticalPadding="0px" />
                                    <NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black" HorizontalPadding="5px"
                                        NodeSpacing="0px" VerticalPadding="1px" />
                                </asp:TreeView>
                            </div>
                        </td>
                        <td width="80%" bgcolor="white" valign="top">
                            <div>
                                <span style="float: left; margin-top: 4px;"><b>当前产品检测能力：</b><asp:Label ID="labNowProduct"
                                    runat="server" Font-Bold="True"></asp:Label>
                                </span><span style="float: right;">
                                    <asp:Button ID="btnRefresh" runat="server" Text="刷新" OnClick="btnRefresh_Click" style="display:none;"/><asp:Button ID="btnCreateItem"
                                        runat="server" Text="添加产品检验能力" OnClick="btnCreateItem_Click" />
                                </span>
                            </div>
                            <br style="clear: both;" />
                            <div style="height: 455px; overflow-x: auto; overflow-y: auto; display: block; border-top: solid 1px #e1e1e1;">
                                <asp:Repeater ID="repProductType" runat="server" OnItemCommand="repProductType_ItemCommand">
                                    <HeaderTemplate>
                                        <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border: solid 1px Grey;">
                                            <tr style="border-bottom: solid 1px Grey; background-color: #F5F5F5;">
                                                <td height="24">
                                                    &nbsp;<img src="images/ul-style.gif" /><b>参数名称:</b><b style="color: Red;"><%# DataBinder.Eval(Container.DataItem, "PType")%></b></td>
                                                <td>
                                                    <b>参考价格:<%# DataBinder.Eval(Container.DataItem, "Guide_Price")%></b></td>
                                                <td>
                                                    <b>创建时间:<%# DataBinder.Eval(Container.DataItem, "Create_Time")%></b></td>
                                                <td align="right">
                                                    <asp:LinkButton ID="lbEdit" runat="server" CommandName="Edit" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "PCA_ID") %>'>编辑</asp:LinkButton>
                                                    &nbsp;&nbsp;
                                                    <asp:LinkButton ID="lbDelete" runat="server" CommandName="Delete" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "PCA_ID") %>'
                                                        OnClientClick="javascript:return confirm('您确定要删除此条记录吗？');">删除</asp:LinkButton>&nbsp;&nbsp;</td>
                                            </tr>
                                            <tr>
                                                <td width="20%" height="24">
                                                    参数模板:</td>
                                                <td width="30%">
                                                    <div style='<%# DataBinder.Eval(Container.DataItem, "Tlt_Xls_PType").ToString()==""?"": "display:none;"%>;'>
                                                        <a href="#" onclick='javascript:InvokePopUploadParFile("<%# DataBinder.Eval(Container.DataItem, "PCA_ID") %>",1);' title="点击上传文件">上传</a>
                                                    </div>
                                                    <div style='<%# DataBinder.Eval(Container.DataItem, "Tlt_Xls_PType").ToString()==""?"display:none;": ""%>;'>
                                                        <asp:ImageButton ImageUrl="images/cross.gif" runat="server" ID="btnDeleteFile1" CommandName="cmd1" ToolTip="删除该文件" 
                                                            CommandArgument='<%# string.Format("{0},{1}",DataBinder.Eval(Container.DataItem, "PCA_ID"),DataBinder.Eval(Container.DataItem, "Tlt_Xls_PType"))%>' />
                                                        <a href='getfile.aspx?fileid=<%# DataBinder.Eval(Container.DataItem, "Tlt_Xls_PType")%>'><%# DataBinder.Eval(Container.DataItem, "filename1")%></a>
                                                    </div>
                                                </td>
                                                <td width="20%">
                                                    报告Word模板（全）:</td>
                                                <td width="30%">
                                                    <div style='<%# DataBinder.Eval(Container.DataItem, "Tlt_Doc_Report").ToString()==""?"": "display:none;"%>;'>
                                                        <a href="#" onclick='javascript:InvokePopUploadParFile("<%# DataBinder.Eval(Container.DataItem, "PCA_ID") %>",2);' title="点击上传文件">上传</a>
                                                    </div>
                                                    <div style='<%# DataBinder.Eval(Container.DataItem, "Tlt_Doc_Report").ToString()==""?"display:none;": ""%>;'>
                                                        <asp:ImageButton ImageUrl="images/cross.gif" runat="server" ID="btnDeleteFile2" CommandName="cmd2" ToolTip="删除该文件" 
                                                            CommandArgument='<%# string.Format("{0},{1}",DataBinder.Eval(Container.DataItem, "PCA_ID"),DataBinder.Eval(Container.DataItem, "Tlt_Doc_Report"))%>' />
                                                        <a href='getfile.aspx?fileid=<%# DataBinder.Eval(Container.DataItem, "Tlt_Doc_Report")%>'><%# DataBinder.Eval(Container.DataItem, "filename2")%></a>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width="20%" height="24">
                                                    大电流试验<br />
                                                    原始记录模板:</td>
                                                <td width="30%">
                                                    <div style='<%# DataBinder.Eval(Container.DataItem, "Tlt_Xls_DDL").ToString()==""?"": "display:none;"%>;'>
                                                        <a href="#" onclick='javascript:InvokePopUploadParFile("<%# DataBinder.Eval(Container.DataItem, "PCA_ID") %>",3);' title="点击上传文件">上传</a>
                                                    </div>
                                                    <div style='<%# DataBinder.Eval(Container.DataItem, "Tlt_Xls_DDL").ToString()==""?"display:none;": ""%>;'>
                                                        <asp:ImageButton ImageUrl="images/cross.gif" runat="server" ID="btnDeleteFile3" CommandName="cmd3" ToolTip="删除该文件" 
                                                            CommandArgument='<%# string.Format("{0},{1}",DataBinder.Eval(Container.DataItem, "PCA_ID"),DataBinder.Eval(Container.DataItem, "Tlt_Xls_DDL"))%>' />
                                                        <a href='getfile.aspx?fileid=<%# DataBinder.Eval(Container.DataItem, "Tlt_Xls_DDL")%>'><%# DataBinder.Eval(Container.DataItem, "filename3")%></a>
                                                    </div>
                                                </td>
                                                <td width="20%">
                                                    大电流试验<br />Word模板:</td>
                                                <td width="30%">
                                                    <div style='<%# DataBinder.Eval(Container.DataItem, "Tlt_Doc_DDL").ToString()==""?"": "display:none;"%>;'>
                                                        <a href="#" onclick='javascript:InvokePopUploadParFile("<%# DataBinder.Eval(Container.DataItem, "PCA_ID") %>",4);' title="点击上传文件">上传</a>
                                                    </div>
                                                    <div style='<%# DataBinder.Eval(Container.DataItem, "Tlt_Doc_DDL").ToString()==""?"display:none;": ""%>;'>
                                                        <asp:ImageButton ImageUrl="images/cross.gif" runat="server" ID="btnDeleteFile4" CommandName="cmd4" ToolTip="删除该文件" 
                                                            CommandArgument='<%# string.Format("{0},{1}",DataBinder.Eval(Container.DataItem, "PCA_ID"),DataBinder.Eval(Container.DataItem, "Tlt_Doc_DDL"))%>' />
                                                        <a href='getfile.aspx?fileid=<%# DataBinder.Eval(Container.DataItem, "Tlt_Doc_DDL")%>'><%# DataBinder.Eval(Container.DataItem, "filename4")%></a>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width="20%" height="24">
                                                    大容量试验<br />原始记录模板:</td>
                                                <td width="30%">
                                                    <div style='<%# DataBinder.Eval(Container.DataItem, "Tlt_Xls_DRL").ToString()==""?"": "display:none;"%>;'>
                                                        <a href="#" onclick='javascript:InvokePopUploadParFile("<%# DataBinder.Eval(Container.DataItem, "PCA_ID") %>",5);' title="点击上传文件">上传</a>
                                                    </div>
                                                    <div style='<%# DataBinder.Eval(Container.DataItem, "Tlt_Xls_DRL").ToString()==""?"display:none;": ""%>;'>
                                                        <asp:ImageButton ImageUrl="images/cross.gif" runat="server" ID="btnDeleteFile5" CommandName="cmd5" ToolTip="删除该文件" 
                                                            CommandArgument='<%# string.Format("{0},{1}",DataBinder.Eval(Container.DataItem, "PCA_ID"),DataBinder.Eval(Container.DataItem, "Tlt_Xls_DRL"))%>' />
                                                        <a href='getfile.aspx?fileid=<%# DataBinder.Eval(Container.DataItem, "Tlt_Xls_DRL")%>'><%# DataBinder.Eval(Container.DataItem, "filename5")%></a>
                                                    </div>
                                                </td>
                                                <td width="20%">
                                                    大容量试验<br />Word模板:</td>
                                                <td width="30%">
                                                    <div style='<%# DataBinder.Eval(Container.DataItem, "Tlt_Doc_DRL").ToString()==""?"": "display:none;"%>;'>
                                                        <a href="#" onclick='javascript:InvokePopUploadParFile("<%# DataBinder.Eval(Container.DataItem, "PCA_ID") %>",6);' title="点击上传文件">上传</a>
                                                    </div>
                                                    <div style='<%# DataBinder.Eval(Container.DataItem, "Tlt_Doc_DRL").ToString()==""?"display:none;": ""%>;'>
                                                        <asp:ImageButton ImageUrl="images/cross.gif" runat="server" ID="btnDeleteFile6" CommandName="cmd6" ToolTip="删除该文件" 
                                                            CommandArgument='<%# string.Format("{0},{1}",DataBinder.Eval(Container.DataItem, "PCA_ID"),DataBinder.Eval(Container.DataItem, "Tlt_Doc_DRL"))%>' />
                                                        <a href='getfile.aspx?fileid=<%# DataBinder.Eval(Container.DataItem, "Tlt_Doc_DRL")%>'><%# DataBinder.Eval(Container.DataItem, "filename6")%></a>
                                                    </div>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td width="20%" height="24">
                                                    备注信息:</td>
                                                <td colspan="3">
                                                    <%# DataBinder.Eval(Container.DataItem, "Rem") %>
                                                </td>
                                            </tr>
                                        </table>
                                        <br />
                                    </ItemTemplate>
                                    <FooterTemplate>
                                        </table>
                                    </FooterTemplate>
                                </asp:Repeater>
                            </div>
                            <br style="clear: both;" />
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <asp:Panel ID="createPanel" runat="server" CssClass="InfoArea" Style="width: 100%;">
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tablehaveborder">
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 120px; height: 24px;">
                            &nbsp;&nbsp;序号：</td>
                        <td style="width: 400px;">
                            <asp:Label ID="labCreateID" runat="server" Width="151px" CssClass="id"></asp:Label></td>
                        <td style="width: 150px;">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 120px; height: 24px;">
                            &nbsp;&nbsp;产品名称：</td>
                        <td style="width: 400px;">
                            <asp:CheckBox ID="ckbIsNewPName" runat="server" Text="新产品" ValidationGroup="Create"  onclick="javascript:setPName();" />
                            <asp:DropDownList ID="ddlCreatePName" runat="server" Width="155px" ValidationGroup="Create" DataTextField="PName" DataValueField="PName" AutoPostBack="True" OnSelectedIndexChanged="ddlCreatePName_SelectedIndexChanged">
                            </asp:DropDownList>
                            <asp:TextBox ID="txtCreatePName" runat="server" ValidationGroup="Create" style="display:none;"></asp:TextBox></td>
                        <td style="width: 150px;">
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 24px;">
                            &nbsp;&nbsp;型号 ：</td>
                        <td>
                            <asp:CheckBox ID="ckbIsNewPModel" runat="server" Text="新型号" ValidationGroup="Create" onclick="javascript:setPModel();" />
                            <asp:DropDownList ID="ddlCreatePModel" runat="server" Width="155px" ValidationGroup="Create" DataTextField="PModel" DataValueField="PModel">
                            </asp:DropDownList>
                            <asp:TextBox ID="txtCreatePModel" runat="server" ValidationGroup="Create"  style="display:none;"></asp:TextBox>
                        </td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 24px;">
                            &nbsp;&nbsp;参数 ：</td>
                        <td>
                            <asp:TextBox ID="txtCreatePType" runat="server" ValidationGroup="Create"></asp:TextBox></td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 24px;">
                            &nbsp;&nbsp;参考价格：</td>
                        <td>
                            <asp:TextBox ID="txtCreateGuidePrice" runat="server" MaxLength="30" ValidationGroup="Create"></asp:TextBox></td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 70px; padding-top: 6px;" valign="top">
                            &nbsp;&nbsp;备注信息：</td>
                        <td colspan="2" valign="top" style="padding-top: 6px;">
                            <asp:TextBox ID="txtCreateRem" runat="server" Height="60px" TextMode="MultiLine"
                                Width="99%" MaxLength="200" ValidationGroup="Create"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                    <tr>
                        <td class="tblfooter" colspan="3" align="right">
                            <asp:Button ID="btnCreateSave" runat="server" Text="保 存" Width="90px" ValidationGroup="Edit"
                                OnClick="btnCreateSave_Click" />
                            <asp:Button ID="btnCreateCancel" runat="server" Text="返 回" Width="90px" OnClick="btnCreateCancel_Click" /></td>
                    </tr>
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <asp:Panel ID="editPanel" runat="server" CssClass="InfoArea" Style="width: 100%;">
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tablehaveborder">
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 120px; height: 24px;">
                            &nbsp;&nbsp;序号：</td>
                        <td style="width: 400px;">
                            <asp:Label ID="labEditID" runat="server" Width="151px" CssClass="id"></asp:Label></td>
                        <td style="width: 150px;">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 120px; height: 24px;">
                            &nbsp;&nbsp;产品名称：</td>
                        <td style="width: 400px;">
                            <asp:Label ID="labEditPName" runat="server"></asp:Label></td>
                        <td style="width: 150px;">
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 24px;">
                            &nbsp;&nbsp;型号 ：</td>
                        <td>
                            &nbsp;<asp:Label ID="labEditPModel" runat="server"></asp:Label></td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 24px;">
                            &nbsp;&nbsp;参数 ：</td>
                        <td>
                            <asp:TextBox ID="txtEditPType" runat="server"></asp:TextBox></td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 24px;">
                            &nbsp;&nbsp;参考价格：</td>
                        <td>
                            <asp:TextBox ID="txtEditGuidePrice" runat="server" MaxLength="30" ValidationGroup="Edit"></asp:TextBox></td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                    <tr>
                        <td style="height: 70px; padding-top: 6px;" valign="top">
                            &nbsp;&nbsp;备注信息：</td>
                        <td colspan="2" valign="top" style="padding-top: 6px;">
                            <asp:TextBox ID="txtEditRem" runat="server" Height="60px" TextMode="MultiLine" Width="99%"
                                MaxLength="200" ValidationGroup="Edit"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                    <tr>
                        <td class="tblfooter" colspan="3" align="right">
                            <asp:Button ID="btnEditSave" runat="server" Text="保 存" Width="90px" ValidationGroup="Edit"
                                OnClick="btnEditSave_Click" />
                            <asp:Button ID="btnEditCancel" runat="server" Text="返 回" Width="90px" OnClick="btnEditCancel_Click" /></td>
                    </tr>
                    <tr>
                        <td style="height: 1px; background-color: #F0F0F0;" colspan="3">
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
